import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import '@wangeditor/editor/dist/css/style.css'

import './static/reset.css'
import './style.css'
import 'element-plus/dist/index.css'
import App from './App.vue'
import pinia from './stores/index.js'
import router from './router/index.js'
import { Buffer } from 'buffer'

// 全局注入 Buffer（浏览器环境）
if (typeof window !== 'undefined') {
  window.Buffer = Buffer
  window.global = window
}
const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(pinia)
app.use(router)
app.use(ElementPlus)
app.mount('#app')
